namespace Jumpton.SFA.Server.Entity
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
    
    
    [System.SerializableAttribute()]
    [RelationMap("ROUTE_CUSTOMERS", typeof(ROUTE_CUSTOMERS), "RC")]
    [Relation(RelationJoinType.Inner, typeof(CONTACT_INFO), "CI", "RC", "CUSTOMER_ID", "CUSTOMER_ID")]
    [Relation(RelationJoinType.Inner, typeof(CUSTOMERS), "C", "CI", "ID", "CUSTOMER_ID")]
    public class ROUTE_CUSTOMERS_VIEW : ObjectRow {
        
        public ROUTE_CUSTOMERS_VIEW() {
        }
        //[RelationMap("ROUTE_CUSTOMERS", typeof(ROUTE_CUSTOMERS), "RC")]
        //[Relation(RelationJoinType.Inner, typeof(CONTACT_INFO), "CI", "RC", "CUSTOMER_ID", "CUSTOMER_ID")]
        //[Relation(RelationJoinType.Inner, typeof(CUSTOMERS), "C", "CI", "ID", "CUSTOMER_ID")]
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public ROUTE_CUSTOMERS_VIEW(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }
        
        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected ROUTE_CUSTOMERS_VIEW(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
        }
        
        [Key("ID", TableAlias = "RC")]
        public decimal ID {
            get {
                return (System.Decimal)GetValue("ID");
            }
            set {
                SetValue("ID", value);
            }
        }
        [Field("USER_ID", TableAlias = "RC")]
        public decimal USERID
        {
            get
            {
                return (System.Decimal)GetValue("USERID");
            }
            set
            {
                SetValue("USERID", value);
            }
        }
        [Field("ROUTE_NUMBER", TableAlias = "RC")]
        public decimal ROUTENUMBER {
            get {
                return (System.Decimal)GetValue("ROUTENUMBER");
            }
            set {
                SetValue("ROUTENUMBER", value);
            }
        }
        
        [Field("SEQUENCE", TableAlias = "RC")]
        public decimal SEQUENCE {
            get {
                return (System.Decimal)GetValue("SEQUENCE");
            }
            set {
                SetValue("SEQUENCE", value);
            }
        }
        
        [Field("ADDRESS_LINE", TableAlias = "CI")]
        public string ADDRESSLINE {
            get {
                return (System.String)GetValue("ADDRESSLINE");
            }
            set {
                SetValue("ADDRESSLINE", value);
            }
        }
        
        [Field("TELEPHONE", TableAlias = "CI")]
        public string TELEPHONE {
            get {
                return (System.String)GetValue("TELEPHONE");
            }
            set {
                SetValue("TELEPHONE", value);
            }
        }
        
        [Field("E_MAIL", TableAlias = "CI")]
        public string EMAIL {
            get {
                return (System.String)GetValue("EMAIL");
            }
            set {
                SetValue("EMAIL", value);
            }
        }
        
        [Field("FAX", TableAlias = "CI")]
        public string FAX {
            get {
                return (System.String)GetValue("FAX");
            }
            set {
                SetValue("FAX", value);
            }
        }
        
        [Field("NAME", TableAlias = "C")]
        public string NAME {
            get {
                return (System.String)GetValue("NAME");
            }
            set {
                SetValue("NAME", value);
            }

        }

        [Field("IDENTITY1", TableAlias = "C")]
        public double IDENTITY1
        {
            get
            {
                try
                {
                    return (System.Double)GetValue("IDENTITY1");
                }
                catch { return 0; }
            }
            set
            {
                SetValue("IDENTITY1", value);
            }
        }

        [Field("IDENTITY2", TableAlias = "C")]
        public double IDENTITY2
        {
            get
            {
                try
                {
                    return (System.Double)GetValue("IDENTITY2");
                }catch{return 0;}
            }
            set
            {
                SetValue("IDENTITY2", value);
            }
        }
        
    }
}
